<template>
  <div class="a"></div>
</template>

<script>
export default {
  name: 'Index',
  data() {
    return {
      componentName: 'my模板名称',
      componentDesc: 'my模板描述'
    }
  },
  methods: {
    modal(checkFn, markType) {
      this.renderVal1 = '';
      this.renderVal2 = 0; // 0 合格 1 不合格
      this.$Modal.confirm({
        render: (h) => {
          return h('div', {}, [
            h('div', {
              class: "ivu-modal-header-inner",
              style: 'margin-bottom: 14px;'
            }, '操作'),
            h('div', {
              class: "render_body",
              style: 'margin-bottom: 20px;'
            }, [
                h('div', {
                  style: `display:${markType === 1 ? 'none' : 'flex'};margin-bottom: 10px;`
                }, [
                    h('span', {
                      style: 'display:inline-block;width:70px;line-height: 34px;'
                    }, '质检结果:'),
                    h('RadioGroup', {
                      props: {
                        value: this.renderVal2
                      },
                      on: {
                        input: (val) => {
                          this.renderVal2 = val
                        }
                      }
                    }, [
                        h('Radio', {
                          style: 'margin-right:20px;',
                          props: {
                            label: 0,
                          }
                        }, "合格"),
                        h('Radio', {
                          props: {
                            label: 1
                          }
                        }, "不合格")
                      ])
                  ]),
                h('div', {
                  style: 'display:flex;'
                }, [
                    h('span', {
                      style: 'display:inline-block;width:70px;'
                    }, '评价:'),
                    h('Input', {
                      props: {
                        value: this.renderVal1,
                        autofocus: true,
                        placeholder: '请输入评价',
                        type: 'textarea'
                      },
                      on: {
                        input: (val) => {
                          this.renderVal1 = val;
                        }
                      }
                    })
                  ])
              ]),
            h('div', {
              class: "render_footer",
              style: 'text-align: right;'
            }, [
                h('Button', {
                  style: 'margin-right: 8px;',
                  on: {
                    click: () => {
                      this.$Modal.remove();
                    }
                  }
                }, '取消'),
                h('Button', {
                  props: {
                    type: "primary",
                  },
                  on: {
                    click: () => {
                      let renderData = {
                        isQualified: this.renderVal2,
                        text: this.renderVal1
                      }
                      if (typeof checkFn === 'function' && !checkFn(renderData)) {
                        return;
                      }
                      this.$Modal.remove();
                    }
                  }
                }, '确定'),
              ])
          ])
        }
      })
      document.getElementsByClassName('ivu-modal-confirm-footer')[0].style.display = 'none'
    }
  },
  mounted() {
    // this.renderVal1 = '';
    // this.modal(val => {
    //   console.log(val)
    //   if (!val) return false;
    // }, 1)
    this.ass_api.getComponentsInfo({id: '5e030d4b7c5f36000163b28a'}).then(data => {
      console.log(data)
      
    })
    this.ass_api.$axios('/custom/5e030d4b7c5f36000163b28a.json', 'GET', {}).then(data => data)
    return;
    this.$Modal.confirm({
      render: (h) => {
        return h('div', {}, [
          h('span', {
            style: 'margin-bottom:6px;display:inline-block;'
          }, '模板名称'),
          h('Input', {
            props: {
              value: this.componentName,
              autofocus: true,
              placeholder: '请输入模板名称'
            },
            on: {
              input: (val) => {
                this.componentName = val;
              }
            }
          }),
          h('span', {
            style: 'margin-bottom:6px;display:inline-block;margin-top: 16px;'
          }, '模板描述'),
          h('Input', {
            props: {
              value: this.componentDesc,
              autofocus: true,
              placeholder: '请输入模板描述'
            },
            on: {
              input: (val) => {
                this.componentDesc = val;
              }
            }
          }),
          h('div', {
            style: 'margin-top: 16px;text-align: right;'
          }, [
              h('Button', {
                style: 'margin-right: 8px;',
                on: {
                  click() {

                  }
                }
              }, '取消'),
              h('Button', {
                props: {
                  type: "primary",
                },
                on: {
                  click() {

                  }
                }
              }, '确定'),
            ])
        ])
      }
    })
    document.getElementsByClassName('ivu-modal-confirm-footer')[0].style.display = 'none'
  }
}
</script>

<style>
</style>
